<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
echo "<h2>Фотогалереи</h2>";
$this->table->set_heading('id', 'Название', 'Фотографий', 'Раздел', 'Действия');
$tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="admin_table">');
$this->table->set_template($tmpl);

$class = 'pg';
if ($this->users_rights_model->check_rights($class, 'block', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'unblock', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'edit', true)) $canedit = 1;
if ($this->users_rights_model->check_rights($class, 'delete', true)) $candelete = 1;
if ($this->users_rights_model->check_rights($class, 'add', true)) $canadd = 1;

$parents[1] = 'Фотогалереи';
$parents[2] = 'Для новостей';
$parents[3] = 'Видеозаписи';

foreach ($pages as $page) {
	$count = $this->db->select()->from('ph')->where('ph_pg', $page['pg_id'])->count_all_results();
	$this->table->add_row(
			$page['pg_id'],
			$page['pg_title'],
			$count,
			$parents[$page['pg_parent']],
			showmeactions(
					$class,
					$page['pg_id'],
					$page['pg_status'],
					$canedit, $candelete, $canblock,
					$from
				)
		);
}
echo $this->table->generate();
echo $paging;
if ($canadd == 1) {
	echo showmeadd($class, 'Добавить галерею');
}
echo "<div class='cc'></div>";
?>
